# -*- coding = utf-8 -*-
# @Time : 2020/12/5 16:09
# @Author : 家幸
# @File : demo4.py
# @Software : PyCharm

# a = ["a","b","c","d"]
# for i in range(len(a)):
#     print(i,a[i])

# i = 0
# while i <5:
#     print("当前是第%d次执行循环"%(i+1))
#     print("i=%d"%i)
#     i += 1

# 1-100求和
# i = 1
# sum = 0
# while i <= 100:
#     sum += i
#     i += 1
# print("1-100求和结果为:%d" % sum)

# my_str = 'I\'m a student'
# print(my_str)

# str = "chengdu"
# print(str)
# print(str[0])
# print(str[0:5])  # [起始位置：结束位置：步进值]
# print(str[1:7:2])
#
# print(str[:5])  # 从0开始到第5个
# print(str[5:])  # 从5开始，一直到结束

print("hello\nchengdu")  #使用反斜杠，实现转义字符的功能
print(r"hello\nchengdu")   #在字符串前面加r，表示直接显示原始字符串，不进行转义